package com.alibaba.order.service;

import com.alibaba.dubbo.OrderService;
import com.alibaba.modle.common.ResponseEntity;
import com.alibaba.modle.order.Order;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @Author: TongRui乀
 * @Date: 2021/8/22 12:10
 * @description：
 */
@Slf4j
@DubboService
public class OrderServiceImpl implements OrderService {


    @Override
    public ResponseEntity<Order> getOrderById(Long id) {

        log.info("getOrderById id:{}", id);

        return ResponseEntity.<Order>builder()
                .code(200)
                .msg("success")
                .data(Order.builder()
                        .id(id)
                        .spu_id(1)
                        .sku_id(1)
                        .price(BigDecimal.valueOf(999))
                        .discountPrice(BigDecimal.valueOf(900))
                        .payTime(LocalDateTime.now())
                        .status((short)1)
                        .build())
                .build();
    }
}
